package com.sxbbc.common.basics.login;

import com.sxbbc.common.basics.utils.date.DateUtil;

/**
 * 会员登录对象
 * @author arno
 *
 */
public class LoginDto {

	private Integer cid;
	/** 登录渠道 见LoginChannelEnums枚举 */
	private Integer channel;
	/** 微信/小程序/APP 唯一编号 */
	private String unionid;
	/** 微信公众号Openid */
	private String wxopenid;
	/** 微信小程序Openid */
	private String programopenid;
	/** 时间戳 */
	private long timestamp=DateUtil.getInstance().currentTimeMillis();
	/** 1不需要过期只限定APP PC H5  0需要过期 */
	private int needTimeout=1;
	/** 默认登陆30天有效期 */
	private long timemout=30*24*3600;
	
	
	

   private static LoginDto  loginDto = null;
   public static LoginDto getInstance(){
	   if(loginDto == null){
	   synchronized(LoginDto.class){
	     if(loginDto == null){ 
	    	 loginDto = new LoginDto();
	       } 
	     } 
	        return loginDto; 
	    }
	return loginDto; 
   }

	private LoginDto() {
		
	}

	/**
	 * 创建APP，PC，H5对象
	 * @param cid 用户id
	 */
	private LoginDto(Integer cid) {
		this.cid=cid;
	}
	
	/**
	 * 创建微信对象
	 * @param cid 用户id
	 * @param wxopenid 微信Openid
	 * @param programopenid 小程序Openid
	 */
	private LoginDto(Integer cid,String wxopenid,String programopenid) {
		this.cid=cid;
		this.wxopenid=wxopenid;
		this.programopenid=programopenid;
	}
	
	/**
	 * 通用对象
	 * @param cid 用户id
	 * @param unionid 微信/小程序/APP 唯一编号
	 * @param wxopenid 微信公众号Openid
	 * @param programopenid 微信小程序Openid
	 */
	private LoginDto(Integer cid,String unionid,String wxopenid,String programopenid) {
		this.cid=cid;
		this.unionid=unionid;
		this.wxopenid=wxopenid;
		this.programopenid=programopenid;
	}
	
	/**
	 * 通用对象
	 * @param cid 用户id
	 * @param channel 登录渠道 见LoginChannelEnums枚举
	 * @param unionid 微信/小程序/APP 唯一编号
	 * @param wxopenid 微信公众号Openid
	 * @param programopenid 微信小程序Openid
	 */
	private LoginDto(Integer cid,Integer channel,String unionid
			,String wxopenid,String programopenid) {
		this.cid=cid;
		this.channel=channel;
		this.unionid=unionid;
		this.wxopenid=wxopenid;
		this.programopenid=programopenid;
	}
	public Integer getCid() {
		return cid;
	}
	public void setCid(Integer cid) {
		this.cid = cid;
	}
	public Integer getChannel() {
		return channel;
	}
	public void setChannel(Integer channel) {
		this.channel = channel;
	}
	public String getUnionid() {
		return unionid;
	}
	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}
	public String getWxopenid() {
		return wxopenid;
	}
	public void setWxopenid(String wxopenid) {
		this.wxopenid = wxopenid;
	}
	public String getProgramopenid() {
		return programopenid;
	}
	public void setProgramopenid(String programopenid) {
		this.programopenid = programopenid;
	}
	public long getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
	public int getNeedTimeout() {
		return needTimeout;
	}
	public void setNeedTimeout(int needTimeout) {
		this.needTimeout = needTimeout;
	}
	public long getTimemout() {
		return timemout;
	}
	public void setTimemout(long timemout) {
		this.timemout = timemout;
	}
}
